package com.wealth.scsj.b_app.presenter;

import android.util.Log;

import com.wealth.scsj.b_app.base.AboutAddNewGoodsBase;
import com.wealth.scsj.b_app.base.QueryCardBase;
import com.wealth.scsj.b_app.bean.AllClassfyBean;
import com.wealth.scsj.b_app.bean.EvaluationStatisticsScoreBean;
import com.wealth.scsj.b_app.bean.GoodsDetailBean;
import com.wealth.scsj.b_app.bean.QueryAllMarksBean;
import com.wealth.scsj.b_app.bean.QueryAllTerraceBean;
import com.wealth.scsj.b_app.bean.QueryCardBean;
import com.wealth.scsj.b_app.bean.QueryShopBrandBean;
import com.wealth.scsj.b_app.model.AboutAddNewShopsModel;
import com.wealth.scsj.b_app.model.QueryCardModel;

import dkmvp.mvp.BasePresenter;
import dkmvp.net.ResponseCallback;
import okhttp3.RequestBody;

/**
 * 修改登录密码presenter
 */

public class AboutAddNewShopsPresenter extends BasePresenter implements AboutAddNewGoodsBase.IPresenter {

    private AboutAddNewGoodsBase.IModel mModel;
    private AboutAddNewGoodsBase.IView mView;

    public AboutAddNewShopsPresenter(AboutAddNewGoodsBase.IView view) {
        mView = view;
        mModel = new AboutAddNewShopsModel();
    }


    @Override
    public void deliverShopBrandData(RequestBody requestBody) {
        addSubscription(mModel.getShopBrandData(requestBody, new ResponseCallback<QueryShopBrandBean>() {
            @Override
            public void onSuccess(QueryShopBrandBean result) {
                if (result.getStatusCode() == 200) {
                    mView.showQueryShopBrandSuccessMsg("根据店铺的id进行查找店铺的品牌成功", result);
                } else {
                    mView.showErrorMsg(result.getMsg());
                }
            }

            @Override
            public void onFaild(String msg) {
                mView.showErrorMsg(msg);
                Log.e("获取用户评价信息失败", msg + "");
            }
        }));
    }

    @Override
    public void deliverAllMarksData(RequestBody requestBody) {
        addSubscription(mModel.getAllMarksData(requestBody, new ResponseCallback<QueryAllMarksBean>() {
            @Override
            public void onSuccess(QueryAllMarksBean result) {
                if (result.getStatusCode() == 200) {
                    mView.showQueryAllMarksSuccessMsg("获取门店运营-商品管理-查询所有标签成功", result);
                } else {
                    mView.showErrorMsg(result.getMsg());
                }
            }

            @Override
            public void onFaild(String msg) {
                mView.showErrorMsg(msg);
                Log.e("获取用户评价信息失败", msg + "");
            }
        }));
    }

    @Override
    public void deliverAllClassfyData(RequestBody requestBody) {
        addSubscription(mModel.getAllClassfyData(requestBody, new ResponseCallback<AllClassfyBean>() {
            @Override
            public void onSuccess(AllClassfyBean result) {
                if (result.getStatusCode() == 200) {
                    mView.showQueryAllClassfySuccessMsg("获取店铺下所有分类成功", result);
                } else {
                    mView.showErrorMsg(result.getMsg());
                }
            }

            @Override
            public void onFaild(String msg) {
                mView.showErrorMsg(msg);
                Log.e("获取用户评价信息失败", msg + "");
            }
        }));
    }

    @Override
    public void deliverAllTerraceData(RequestBody requestBody) {
        addSubscription(mModel.getAllTerraceData(requestBody, new ResponseCallback<QueryAllTerraceBean>() {
            @Override
            public void onSuccess(QueryAllTerraceBean result) {
                if (result.getStatusCode() == 200) {
                    mView.showQueryAllTerraceSuccessMsg("获取店铺下平台分类成功", result);
                } else {
                    mView.showErrorMsg(result.getMsg());
                }
            }

            @Override
            public void onFaild(String msg) {
                mView.showErrorMsg(msg);
                Log.e("获取用户评价信息失败", msg + "");
            }
        }));
    }

    @Override
    public void deliberAllGoodsData(RequestBody requestBody) {
        addSubscription(mModel.getAllGoodsData(requestBody, new ResponseCallback<GoodsDetailBean>() {
            @Override
            public void onSuccess(GoodsDetailBean result) {
                if (result.getStatusCode() == 200) {
                    mView.showQueryAllGoodsDetailSuccessMsg("商品详情结果拿到了,sb", result);
                } else {
                    mView.showErrorMsg("商品详情结果报错了，sb"+result.getMsg());
                }
            }

            @Override
            public void onFaild(String msg) {
                mView.showErrorMsg("商品详情结果报错了，sb"+msg);
                Log.e("商品详情结果报错了，sb", msg + "");
            }
        }));
    }
}
